<template>
  <div class="home-container">
    <router-view :funcList="funcList"></router-view>
    <div class="footer">
      <van-tabbar v-model="active" :placeholder="true" route>
        <van-tabbar-item icon="home-o" push to="/main">首页</van-tabbar-item>
        <van-tabbar-item icon="search" push to="/statistics">统计</van-tabbar-item>
        <van-tabbar-item icon="friends-o" push to="/stock">仓库</van-tabbar-item>
        <van-tabbar-item icon="setting-o" push to="/set">我的</van-tabbar-item>
      </van-tabbar>
    </div>
  </div>
</template>

<script>
import { ipApi, weatherApi } from "@/api/weatherApi";

export default {
  data() {
    return {
      active:'',
      funcList: [
        {
          title: "基础数据",
          items: [
            {
              id: "SYSTEM-01-05",
              path: "/product/list",
              name: "物资管理",
              icon: "&#xe609;",
              right: "R",
            },
            {
              id: "SYSTEM-01-05",
              path: "/product/edit",
              name: "物资新建",
              icon: "&#xe605;",
              right: "C",
            },
            {
              id: "SYSTEM-01-06",
              path: "/supplier/list",
              name: "供应商管理",
              icon: "&#xe73f;",
              right: "R",
            },
            {
              id: "SYSTEM-01-06",
              path: "/supplier/edit",
              name: "供应商新建",
              icon: "&#xe9aa;",
              right: "C",
            },
          ],
        },
        {
          title: "项目管理",
          items: [
            {
              id: "PROJECT-01-01",
              name: "项目管理",
              path: "/project/list",
              icon: "&#xe60b;",
              right: "R",
            },
            {
              id: "PROJECT-01-02",
              name: "项目新建",
              path: "/project/edit",
              icon: "&#xe63b;",
              right: "C",
            },
          ],
        },
        {
          title: "采购管理",
          items: [
            {
              id: "PURCHASE-01-01",
              name: "采购管理",
              icon: "&#xe649;",
              path: "/purchase/list",
              right: "R",
            },
            {
              id: "PURCHASE-01-02",
              name: "采购新建",
              icon: "&#xe60f;",
              path: "/purchase/edit",
              right: "C",
            },
          ],
        },
        {
          title: "收货管理",
          items: [
            {
              id: "RECEIVING-01-01",
              name: "收货管理",
              icon: "&#xe606;",
              path: "/recevie/list",
              right: "R",
            },
            {
              id: "RECEIVING-01-02",
              name: "收货新建",
              icon: "&#xe65a;",
              path: "/recevie/edit",
              right: "C",
            },
          ],
        },
        // {
        //   title: "系统管理",
        //   items: [{ id: "", name: "设置", path: "/setting", icon: "&#xe68d;" }],
        // },
      ],
    };
  },
  methods:{
    editEvt(){
      this.$router.push('/receiving/receivingEdit')
    }
  },
 mounted(){
  this.getWeather()
  }
  ,methods:{
   async getWeather(){
          //获取天气信息
    let adress = await ipApi();
    let city = adress.result.ad_info.city
    let weather  = await weatherApi(city);
    this.$store.commit('common/SAVE_WEATHER',weather.data)
    }
  }
};

</script>

<style lang="less" scoped>
//大盒子样式
.home-container {
  height: 100%;
 }
</style>
